package com.whut.controller;

import com.whut.common.BaseResponse;
import com.whut.service.ProjectBuildBasementService;
import com.whut.v_request.ProjectSampleV3ConfirmRequest;
import com.whut.v_request.ProjectSampleV3Request;
import com.whut.v_vo.projectBuildBasement.EditProjectBuildBasementVo;
import com.whut.v_vo.projectBuildBasement.ProjectBuildBasementVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 项目楼栋（项目进度信息——地下室）
 */
@RestController
@RequestMapping("/projectBuildBasement")
public class ProjectBuildBasementController {

    @Autowired(required = false)
    private ProjectBuildBasementService projectBuildBasementService;

    /**
     * 根据ID查询
     *
     * @param basementId
     * @return
     */
    @GetMapping("/findById")
    public BaseResponse findBuildBasementById(Integer basementId) {
        return projectBuildBasementService.findBuildBasementById(basementId);
    }

    /**
     * 根据施工项目ID查询地下室施工进度
     *
     * @param projectId
     * @return
     */
    @GetMapping("/findByProject")
    public BaseResponse findBuildBasementsByProjectId(Integer projectId) {
        return projectBuildBasementService.findBuildBasementsByProjectId(projectId);
    }

    /**
     * 保存地下室进度信息
     *
     * @param projectBuildBasementVo
     */
    @PostMapping("/save")
    public BaseResponse saveBuildBasement(@RequestBody ProjectBuildBasementVo projectBuildBasementVo) {

        return projectBuildBasementService.saveBuildBasement(projectBuildBasementVo);

    }

    /**
     * 根据ID修改
     *
     * @param editProjectBuildBasementVo
     */
    @PostMapping("/edit")
    public BaseResponse editBuildBasement(@RequestBody EditProjectBuildBasementVo editProjectBuildBasementVo) {

        return projectBuildBasementService.editBuildBasement(editProjectBuildBasementVo);

    }

    /**
     * 根据ID删除
     *
     * @param basementId
     * @return
     */
    @DeleteMapping("/deleteById/{basementId}")
    public BaseResponse deleteBuildBasement(@PathVariable Integer basementId) {

        return projectBuildBasementService.deleteBuildBasement(basementId);

    }

    /**
     * 地下室抽样
     *
     * @param request
     * @return
     */
    @PostMapping("/projectBuildBasementCheck")
    public BaseResponse projectBuildBasementCheck(@RequestBody ProjectSampleV3Request request) {
        return projectBuildBasementService.projectBuildBasementCheck(request);
    }

    /**
     * 地下室确定抽样
     *
     * @param request
     * @return
     */
    @PostMapping("/projectBuildBasementConfirm")
    public BaseResponse projectBuildBasementCheck(@RequestBody ProjectSampleV3ConfirmRequest request) {
        return projectBuildBasementService.projectBuildBasementConfirm(request);
    }

}
